home *** CD-ROM | disk | FTP | other *** search
/ CD-ROM Today - The Disc! 5 / CD-ROM Today - The Disc (Issue 5)(November 1994).ISO / mac / Mac shareware / Utilities / Kill Drive ƒ / Kill Drive.c < prev    next >
C/C++ Source or Header  |  1994-09-21  |  865b  |  68 lines

  1. // UTableBase = 0x11C,            /*[GLOBAL VAR] Base address of unit table unit I/O table [pointer]*/
  2. // UnitNtryCnt = 0x1D2,            /*[GLOBAL VAR]  count of entries in unit table [word]*/
  3.  
  4.  
  5. Ptr FindMI(void);
  6.  
  7.  
  8. void main(void)
  9. {
  10.     Handle h,u;
  11.     int x,y;
  12.     DCtlPtr d;
  13.     Ptr miptr;
  14.  
  15.     miptr=FindMI();
  16.     ;;
  17.     if (miptr)
  18.     {
  19.         u=(Handle)UTableBase;
  20.         
  21.         for (x=1;x<UnitNtryCnt;x++)
  22.         {
  23.             if (u[x])
  24.             {
  25.                 h=(Handle)(u[x]);
  26.                 if (h)
  27.                 {
  28.                     d=(DCtlPtr)((Handle)(h[0]));
  29.                     if (d->dCtlRefNum == 0xFFFB)
  30.                     {
  31.                         y++;
  32.                         u[x]=miptr;
  33.                         y++;
  34.                     }
  35.                 }
  36.             }
  37.         }
  38.     }
  39. }
  40.  
  41.  
  42. Ptr FindMI(void)
  43. {
  44.     Handle h,u;
  45.     int x;
  46.     DCtlPtr d;
  47.     Ptr miptr=0;
  48.             
  49.     u=(Handle)UTableBase;
  50.     
  51.     for (x=1;x<UnitNtryCnt;x++)
  52.     {
  53.         if (u[x])
  54.         {
  55.             h=(Handle)(u[x]);
  56.             if (h)
  57.             {
  58.                 d=(DCtlPtr)((Handle)(h[0]));
  59.                 if (d->dCtlRefNum == 0xFFE0)
  60.                 {
  61.                     miptr=u[x];
  62.                 }
  63.             }
  64.         }
  65.     }
  66.     return miptr;
  67. }
  68.